home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- proc string[] uniqueTransformNodes(
- string $transNodes[]
- )
- //
- // Description:
- // Eliminate all the double transform nodes, so the return list
- // has all the unique ones.
- //
- {
- string $uniqTrans[];
- int $transIdx = 0;
-
- for ( $trans in $transNodes ) {
- int $skip = 0;
- for ($tmpTrans in $uniqTrans ) {
- if ( $trans == $tmpTrans ) {
- $skip = 1;
- break;
- }
- }
-
- // add it to the list
- if ( $skip == 0 ) {
- $uniqTrans[$transIdx] = $trans;
- $transIdx ++;
- }
- }
- return $uniqTrans;
- }
-
-
- global proc int art3dPaintCountShapes(
- string $shader
- )
- //
- // Description:
- // Returns number of paintable shapes connected
- // to a given shader. We need to eliminate all
- // the intermediate objects from counting.
- //
- {
- int $numShapes = 0;
-
- string $shaderPlug = $shader + ".outColor";
- string $shEngs[] = `listConnections $shaderPlug`;
-
- int $intermediate = 0;
- for( $sE in $shEngs ) {
- string $shEngPlug = $sE + ".dagSetMembers";
-
- // bug id 150916, skip layered shaders
- if( `objExists $shEngPlug` == 0 )
- continue;
-
- string $transNodes[] = `listConnections $shEngPlug`;
- string $trans[] = uniqueTransformNodes( $transNodes );
-
- for ($t in $trans) {
- string $shapes[] = `listRelatives -shapes -pa $t`;
- for ( $s in $shapes ) {
- // Skip the intermediate objects.
- $intermediate = `getAttr ($s + ".intermediateObject")`;
- if ( $intermediate ) continue;
-
- $numShapes ++;
- }
- }
- }
-
- return $numShapes;
- }
-